<template>
	<view>
		<u-navbar titleStyle="font-size:40rpx;color:#333" :placeholder='true' title="申请退款" :autoBack="true">
		</u-navbar>
		<view class="paddingLR32">
			<view class="">
				<view class="" v-if="refund_id || refund_id===0">
					<view class="whiteBox mt24">
						<view class="flex fontS24">
							<!-- 店铺信息 不可删 -->
							<u-image :src="store.store_image" :lazy-load="true" width="48rpx"
								height="48rpx" radius='24rpx' />
							<view class="" style="margin-left: 16rpx;">
								 {{store.store_name}} 
							</view>
						</view>
						<view class="flexJBC" style="margin:24rpx auto 28rpx;align-items: flex-start;" >
							<u-image :src="store.image" :lazy-load="true" width="80" height="80"
								radius='10' />
							<view class="fontS24" style="width: 72%;">
								<view class="flexJBC">
									<view class="elipes1 " style="width:80%;">
										{{store.product_name}}
									</view>
									<view class="co9">
										¥{{store.product_price}}
									</view>
								</view>
								<view style="margin-top: 10rpx;" class="flexJBC">
									<view class="co6" style="width: 80%;">
										规格参数：{{store.detail}}
									</view>
									<view class="co9">
										x{{store.product_num}}
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
				<view class="whiteBox mt24" v-for="(item,index) in store" :key="index" v-else>
					<view class="flex fontS24">
						<!-- 店铺信息 不可删 -->
						<u-image :src="item.goods[0].store_image" :lazy-load="true" width="48rpx"
							height="48rpx" radius='24rpx' />
						<view class="" style="margin-left: 16rpx;">
							 {{item.goods[0].store_name?item.goods[0].store_name:''}} 
						</view>
					</view>
					<view class="flexJBC" style="margin:24rpx auto 28rpx;align-items: flex-start;" v-for="(itemm,indexx) in item.goods" :key="indexx">
						<u-image :src="itemm.image" :lazy-load="true" width="80" height="80"
							radius='10' />
						<view class="fontS24" style="width: 72%;">
							<view class="flexJBC">
								<view class="elipes1 " style="width:80%;">
									{{itemm.product_name}}
								</view>
								<view class="co9">
									¥{{itemm.product_price}}
								</view>
							</view>
							<view style="margin-top: 10rpx;" class="flexJBC">
								<view class="co6" style="width: 80%;">
									规格参数：{{itemm.detail}}
								</view>
								<view class="co9">
									x{{itemm.product_num}}
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="mt24 whiteBox flexJBC" @click="gorefundDetail(1)">
				<view class="flexRowCenter " style="width: 100%;">
					<view class="center">
						<view class="fontS32">
							我要退款（无需退货）
						</view>
						<view class="co9">
							未收到货
						</view>
					</view>
				</view>
				<u-icon name="arrow-right"></u-icon>
			</view>
			<view class="mt24 whiteBox flexJBC" @click="gorefundDetail(2)">
				<view class="flexRowCenter " style="width: 100%;">
					<view class="center">
						<view class="fontS32">
							已收到货，我要退货退款
						</view>
						<view class="co9">
							需要您寄回已收到的货物
						</view>
					</view>
				</view>
				<u-icon name="arrow-right"></u-icon>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				store:[],
				refund_id:undefined,  //有值表示是退款订单再次申请
			}
		},
		methods: {
			gorefundDetail(type){
				// type 1是退款 2是退货退款
				if(this.refund_id || this.refund_id===0){
					this.$my.go('/pages/my/order/refund/refundDetail?type='+type+'&order_product_id='+this.store.order_product_id+'&price='+this.store.total_price)
				}else{
					// let order_product_id=[];
					// this.store.forEach(item=>{
					// 	item.goods.forEach(item1=>{
					// 		order_product_id.push(item1.order_product_id)
					// 	})
					// })
					// order_product_id=order_product_id.join(',')
					console.log(this.store)
					this.$my.go('/pages/my/order/refund/refundDetail?type='+type+'&order_product_id='+this.store[0].goods[0].order_product_id+'&price='+this.store[0].goods[0].total_price)
				}
			}
		},
		onLoad(option) {
			this.store=option.store?JSON.parse(option.store):[];
			if(Number(option.refund_id) || Number(option.refund_id)===0){
				this.refund_id=Number(option.refund_id)
			}
			console.log(this.store,this.refund_id)
		}
	}
</script>


<style lang="scss" scoped>

</style>
